package io.renren.modules.simida.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.simida.entity.UserMakeCommentEntity;
import io.renren.modules.simida.service.UserMakeCommentService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 用户约会评论
 *
 * @author miaoguoxin
 * @email ${email}
 * @date 2019-11-19 21:07:58
 */
@RestController
@RequestMapping("simida/usermakecomment")
public class UserMakeCommentController {
    @Autowired
    private UserMakeCommentService userMakeCommentService;


    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @RequiresPermissions("simida:userinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userMakeCommentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("simida:userinfo:info")
    public R info(@PathVariable("id") Long id){
		UserMakeCommentEntity userMakeComment = userMakeCommentService.getById(id);

        return R.ok().put("userMakeComment", userMakeComment);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("simida:userinfo:save")
    public R save(@RequestBody UserMakeCommentEntity userMakeComment){
		userMakeCommentService.save(userMakeComment);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("simida:userinfo:update")
    public R update(@RequestBody UserMakeCommentEntity userMakeComment){
		userMakeCommentService.updateById(userMakeComment);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @RequiresPermissions("simida:userinfo:delete")
    public R delete(@PathVariable Long id){
        userMakeCommentService.deleteById(id);
        return R.ok();
    }

}
